Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough특정 장소의 리뷰 목록을 조회하는 GET 엔드포인트를 추가했습니다. 컨트롤러, 서비스(구현체 포함), 리포지토리 쿼리, 그리고 응답 DTO 레코드들(리뷰 항목 및 목록 응답)이 도입되어 지정된 장소의 리뷰들을 생성일 역순으로 반환합니다. Changes
Sequence DiagramsequenceDiagram
participant Client
participant Controller as PlaceReviewController
participant Service as PlaceReviewService
participant Repo as PlaceReviewRepository
participant DB as Database
participant ImgProv as ImageUrlProvider
Client->>Controller: GET /api/places/reviews/{placeId}/reviews
Controller->>Service: getPlaceReviews(placeId)
Service->>Service: validate place exists & active
Service->>Repo: findAllByPlaceIdOrderByCreatedAtDesc(placeId)
Repo->>DB: Query with join fetch user & images
DB-->>Repo: List<PlaceReview>
Repo-->>Service: List<PlaceReview>
loop for each review
Service->>ImgProv: resolve profile image URL
ImgProv-->>Service: profile image URL
Service->>Service: map to PlaceReviewListItem
end
Service-->>Controller: GetPlaceReviewListResponse
Controller-->>Client: CustomApiResponse<GetPlaceReviewListResponse>
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/java/org/sopt/solply_server/domain/review/repository/PlaceReviewRepository.java (1)
11-19: 리뷰/이미지 전체 적재는 데이터 증가 시 병목이 될 수 있습니다.Line 11~19는 한 번에 전체 리뷰와 이미지를 모두 로딩합니다. 장소별 리뷰가 많아지면 결과 row가 크게 불어나 응답 지연/메모리 사용량이 커질 수 있으니, 페이지네이션(또는 최신 N개 제한 + 추가 조회) 구조를 고려해 주세요.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/org/sopt/solply_server/domain/review/repository/PlaceReviewRepository.java` around lines 11 - 19, The current repository method findAllByPlaceIdOrderByCreatedAtDesc in PlaceReviewRepository loads all reviews and their images at once, which will scale poorly; change it to a paginated two-step fetch: 1) add a pageable query that selects only review ids (e.g., a new method like findReviewIdsByPlaceIdOrderByCreatedAtDesc(Long placeId, Pageable pageable) or use existing signature but accept Pageable) to retrieve paged review ids, and 2) add a second query to load reviews with images for those ids (e.g., findAllByIdInFetchImages(List<Long> ids) that uses join fetch pr.placeReviewImages) so you avoid join-fetch + Pageable limitations and large result sets; update service logic to call the id-page query then the fetch-by-ids query to return the paged reviews.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@src/main/java/org/sopt/solply_server/domain/review/controller/PlaceReviewController.java`:
- Around line 31-33: The GET handler getPlaceReviews in PlaceReviewController
lacks authenticated user injection; add a method parameter annotated with
`@CurrentUserId` (e.g., `@CurrentUserId` Long userId) to enforce JWT-based
authentication, update the method signature in
PlaceReviewController.getPlaceReviews, pass the userId into any downstream call
(for example to placeReviewService.getPlaceReviews(placeId, userId) or adjust
service signature accordingly), and add the necessary import for the
`@CurrentUserId` annotation.
---
Nitpick comments:
In
`@src/main/java/org/sopt/solply_server/domain/review/repository/PlaceReviewRepository.java`:
- Around line 11-19: The current repository method
findAllByPlaceIdOrderByCreatedAtDesc in PlaceReviewRepository loads all reviews
and their images at once, which will scale poorly; change it to a paginated
two-step fetch: 1) add a pageable query that selects only review ids (e.g., a
new method like findReviewIdsByPlaceIdOrderByCreatedAtDesc(Long placeId,
Pageable pageable) or use existing signature but accept Pageable) to retrieve
paged review ids, and 2) add a second query to load reviews with images for
those ids (e.g., findAllByIdInFetchImages(List<Long> ids) that uses join fetch
pr.placeReviewImages) so you avoid join-fetch + Pageable limitations and large
result sets; update service logic to call the id-page query then the
fetch-by-ids query to return the paged reviews.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 5b9202bb-9b4d-4c44-bb61-52f88534cfe9
📒 Files selected for processing (6)
src/main/java/org/sopt/solply_server/domain/review/controller/PlaceReviewController.javasrc/main/java/org/sopt/solply_server/domain/review/dto/response/GetPlaceReviewListResponse.javasrc/main/java/org/sopt/solply_server/domain/review/dto/response/PlaceReviewListItem.javasrc/main/java/org/sopt/solply_server/domain/review/repository/PlaceReviewRepository.javasrc/main/java/org/sopt/solply_server/domain/review/service/PlaceReviewService.javasrc/main/java/org/sopt/solply_server/domain/review/service/PlaceReviewServiceImpl.java
🌳이슈 번호
resolves #356
☀️어떻게 이슈를 해결했나요?
장소 상세에서 리뷰 목록을 조회하기 위한 API를 구현
PlaceReview 엔티티를 기반으로 placeId에 해당하는 리뷰를 최신순(createdAt DESC)으로 조회하도록 Repository 메서드를 작성
조회된 리뷰 데이터는 PlaceReviewListItem DTO로 변환하여 응답하도록 구성
이때,
작성자 정보(userId, nickname, profileImageUrl)
방문 날짜(visitedAt) 및 시간대(visitTimeSlot)
리뷰 내용(content)
리뷰 이미지 리스트(imageUrls)
를 포함하도록 설계했습니다.
이미지의 경우, S3에 저장된 file key를 클라이언트에서 사용할 수 있는 URL로 변환하기 위해 ImageUrlProvider를 활용하도록 수정
서비스 레이어에서는 placeRepository.findActiveById()를 통해 존재하지 않는 장소에 대한 예외 처리를 추가하여 안정성을 확보
최종적으로 리뷰 리스트를 GetPlaceReviewListResponse로 감싸 반환하도록 구현하여, API 응답 구조를 일관되게 유지
🗯️ PR 포인트
(테스트 유저에는 프로필 사진을 넣지 않아 null이 나옵니다)
테스팅 화면
Summary by CodeRabbit
릴리스 노트